import { createBrowserRouter,Navigate } from 'react-router-dom'
import Login from '../pages/login'
import User from '../pages/user'
import Main from '../pages/main'
import News from '../pages/news'
import Comment from "../pages/comment";
import UserDetail from "../pages/user/detail";
import NewsDetail from "../pages/news/detail";
export const routes = [
    {
        path: 'login',
        Component: Login,
        title: '登录'
    },
    {
        path: '/',
        Component: Main,
        children: [
            // 重定向
            {
                path: '/',
                element: <Navigate to={"users"} replace />,
                title: '用户管理'
            },
            {
                path: 'users',
                Component: User,
                title: '用户管理'
            },
            {
                path: 'users/detail',
                Component: UserDetail,
                title: '用户管理详情'
            },
            {
                path: 'news',
                Component: News,
                title: '内容管理'
            },
            {
                path: 'news/detail',
                Component: NewsDetail,
                title: '内容管理详情'
            },
            {
                path: 'comments',
                Component: Comment,
                title: '评论管理'
            }
        ],
    }
]

export default createBrowserRouter(routes)
